home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Applications 1996 May
/
SGI IRIX 6.2 Applications 1996 May.iso
/
dist
/
impr_dev.idb
/
usr
/
impressario
/
src
/
libspool
/
spoolI.h.z
/
spoolI.h
Wrap
C/C++ Source or Header
|
1996-05-06
|
8KB
|
273 lines
/**************************************************************************
* *
* Copyright (c) 1991 Silicon Graphics, Inc. *
* All Rights Reserved *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI *
* *
* The copyright notice above does not evidence any actual of intended *
* publication of such source code, and is an unpublished work by Silicon *
* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
* the property of Silicon Graphics, Inc. Any use, duplication or *
* disclosure not specifically authorized by Silicon Graphics is strictly *
* prohibited. *
* *
* RESTRICTED RIGHTS LEGEND: *
* *
* Use, duplication or disclosure by the Government is subject to *
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in *
* Technical Data and Computer Software clause at DFARS 52.227-7013, *
* and/or in similar or successor clauses in the FAR, DOD or NASA FAR *
* Supplement. Unpublished - rights reserved under the Copyright Laws of *
* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N. *
* Shoreline Blvd., Mountain View, CA 94039-7311 *
**************************************************************************
*
* File: spoolI.h
*
* Description: Internal include file for the libspool, spooling system API
* library. This file contains information of use internally by the
* files that comprise libspool. This file is not intended to be
* included in any user level application program.
*
**************************************************************************/
#ident "$Revision: 1.7 $"
#ifndef _SL_SPOOLI_H
#define _SL_SPOOLI_H
#include "msgs/uxsgiimpr.h" /* i18n support */
#include "spool.h"
/* Commands */
#define SL_CMD_SH_NAME "sh"
#define SL_CMD_ECHO_NAME "echo"
#define SL_CMD_LPR_NAME "lpr"
#define SL_CMD_LPRM_NAME "lprm"
#define SL_CMD_LPQ_NAME "lpq"
#ifdef sgi
#define SL_CMD_SH "/bin/sh"
#define SL_CMD_ECHO "/bin/echo"
#define SL_CMD_LPR "/usr/bsd/lpr"
#define SL_CMD_LPRM "/usr/bsd/lprm"
#define SL_CMD_LPQ "/usr/bsd/lpq"
#else
#define SL_CMD_SH "/usr/bin/sh"
#define SL_CMD_ECHO "/usr/bin/echo"
#define SL_CMD_LPR "/usr/ucb/lpr"
#define SL_CMD_LPRM "/usr/ucb/lprm"
#define SL_CMD_LPQ "/usr/ucb/lpq"
#endif
#define SL_CMD_RSH_NAME "rsh"
#define SL_CMD_RSH "/usr/bsd/rsh"
#define SL_CMD_LPC_NAME "lpc"
#define SL_CMD_LPC "/usr/etc/lpc"
#define SL_CMD_LP_NAME "lp"
#define SL_CMD_LP "/usr/bin/lp"
#define SL_CMD_CANCEL_NAME "cancel"
#define SL_CMD_CANCEL "/usr/bin/cancel"
#define SL_CMD_ENABLE_NAME "enable"
#define SL_CMD_ENABLE "/usr/bin/enable"
#define SL_CMD_DISABLE_NAME "disable"
#define SL_CMD_DISABLE "/usr/bin/disable"
#define SL_CMD_ACCEPT_NAME "accept"
#define SL_CMD_ACCEPT "/usr/lib/accept"
#define SL_CMD_REJECT_NAME "reject"
#define SL_CMD_REJECT "/usr/lib/reject"
#define SL_CMD_LPSTAT_NAME "lpstat"
#define SL_CMD_LPSTAT "/usr/bin/lpstat"
#define SL_CMD_SH_FLAG "-c"
#define SL_SH_REDIRECT "2>&1"
/* Message formatting */
#define SL_LANG "LANG=C"
#define SL_MSGFORMAT "MSGVERB=label:text:action"
/* Spooler specific files and info */
#define SL_LP_DIR "/var/spool/lp"
#define SL_LP_LOCK "/var/spool/lp/SCHEDLOCK"
#ifdef sgi
#define SL_LPD_LOCK "/var/spool/lpd/lpd.lock"
#else
#define SL_LPD_LOCK "/var/spool/lpd.lock"
#endif
/* Misc info */
#define SL_BUFSIZ 8192
#define SL_SML_BUFSIZ 1024
#define SL_BUF_PRINTCAP 1025
#define SL_TRUE 1
#define SL_FALSE 0
/* Needed because Sun's strdup prototype declares its argument char*
instead of const char* */
#ifdef sgi
#define SL_CHAR_CAST
#else
#define SL_CHAR_CAST (char*)
#endif
/* Misc macros */
#define RETURN_ERROR(err_code) { \
SLerrno = (err_code); \
return SL_ERROR; \
}
#define RETURN_ERROR_PTR(err_code) { \
SLerrno = (err_code); \
return NULL; \
}
#define CHECK_DEF_SPOOLER if (!def_spooler) { \
uint sp, avail; \
if (SLGetSpooler(&sp, &avail) < 0) { \
return SL_ERROR; \
} \
if (!sp) \
RETURN_ERROR(SL_ERR_NO_SPOOLERS); \
}
#define CHECK_DEF_SPOOLER_PTR if (!def_spooler) { \
uint sp, avail; \
if (SLGetSpooler(&sp, &avail) < 0) { \
return NULL; \
} \
if (!sp) \
RETURN_ERROR_PTR(SL_ERR_NO_SPOOLERS); \
}
/* Job submittal source types and structures */
#define SL_JOB_FILENAME 1
#define SL_JOB_FD 2
#define SL_JOB_BUF 3
typedef struct {
int type;
const char *filename;
} SLFilenameJobSourceStruct;
typedef struct {
int type;
int file_desc;
} SLFdJobSourceStruct;
typedef struct {
int type;
const void *buffer;
size_t amount;
} SLBufJobSourceStruct;
typedef union {
int type;
SLFilenameJobSourceStruct filename_job;
SLFdJobSourceStruct fd_job;
SLBufJobSourceStruct buf_job;
} SLJobSourceUnion;
/* Spooler info structure */
typedef struct {
unsigned int mask;
int (*find_spooler_func)(void);
int (*get_printers_func)(SLPrinterStruct**, int*);
int (*get_printer_info_func)(const char*, SLPrinterStruct**);
int (*get_def_printer_func)(char**);
int (*get_printer_settings_func)(const char*, SLSettingsStruct**);
int (*submit_job_func)(SLJobSourceUnion*, const char*, int, int, int,
const char*, const char*,
char**);
int (*cancel_job_func)(const char*, const char*);
int (*get_spooler_state_func)(const char*, int, int*);
int (*set_spooler_state_func)(const char*, int, int);
int (*get_queue_func)(const SLPrinterStruct*, int, SLQueueStruct**, int*);
#ifdef _SL_FASTPATH
int (*supports_fast_job)(const char *);
#endif /* _SL_FASTPATH */
char* (*find_username)(void);
} SLSpoolerStruct;
/* Internal globals */
extern char **_SLspooler_out_buf;
extern int _SLspooler_nout;
extern int _SLspooler_exit;
/* Internal function declarations */
#ifdef __cplusplus
extern "C" {
#endif
extern int _SLIsEmpty(const char*);
extern int _SLBsdFindSpooler(void);
extern int _SLSysVFindSpooler(void);
extern int _SLBsdGetPrinterList(SLPrinterStruct**, int*);
extern int _SLSysVGetPrinterList(SLPrinterStruct**, int*);
extern int _SLBsdGetPrinterInfo(const char*, SLPrinterStruct**);
extern int _SLSysVGetPrinterInfo(const char*, SLPrinterStruct**);
extern int _SLBsdGetDefPrinterName(char**);
extern int _SLSysVGetDefPrinterName(char**);
extern char* _SLSkipSpace(char*);
extern void _SLInitPlist(SLPrinterStruct**, int*);
extern void _SLInitPentry(SLPrinterStruct*);
extern void _SLAddPrinter(const SLPrinterStruct*, SLPrinterStruct**, int*);
extern SLQueueStruct* _SLAddQueue(SLQueueStruct**, int*);
extern void _SLInitQueue(SLQueueStruct**, int*);
extern void _SLFreeQueueEntry(SLQueueStruct*);
extern int _SLSysVSubmitJob(SLJobSourceUnion*, const char*, int, int, int,
const char*, const char*, char**);
extern int _SLBsdSubmitJob(SLJobSourceUnion*, const char*, int, int, int,
const char*, const char*, char**);
extern int _SLExec(SLJobSourceUnion*, char*, int, int*);
extern int _SLSysVCancelJob(const char*, const char*);
extern int _SLBsdCancelJob(const char*, const char*);
extern int _SLSysVGetSpoolerState(const char*, int, int*);
extern int _SLSysVSetSpoolerState(const char*, int, int);
extern int _SLBsdGetSpoolerState(const char*, int, int*);
extern int _SLBsdSetSpoolerState(const char*, int, int);
extern int _SLSysVGetQueue(const SLPrinterStruct*, int,
SLQueueStruct**, int*);
extern int _SLBsdGetQueue(const SLPrinterStruct*, int,
SLQueueStruct**, int*);
extern int _SLSysVGetPrinterSettings(const char*, SLSettingsStruct**);
extern int _SLSysVGetSpoolerOptions(SLSysVSpoolerOptionsStruct**);
extern int _SLSysVGetPrinterOptions(const char*, char**);
extern int _SLSysVSaveSpoolerOptions(SLSysVSpoolerOptionsStruct*);
extern int _SLSysVSavePrinterOptions(const char*, char*, int);
extern int _SLBsdGetPrinterSettings(const char*, SLSettingsStruct**);
#ifdef _SL_FASTPATH
extern int _SLSysVSupportsFastJob(const char *);
extern int _SLBsdSupportsFastJob(const char *);
#endif /* _SL_FASTPATH */
extern char* _SLSysVFindUserName(void);
extern char* _SLBsdFindUserName(void);
#ifdef __cplusplus
}
#endif
#endif /* _SL_SPOOLI_H */